home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / supratxt.zip / BIN2DEC.TXT < prev    next >
Text File  |  1993-02-09  |  2KB  |  48 lines

  1. This text was posted to Supra by a user to help others understand how to set
  2. bit-mapped registers on modems and similiar devices.
  3.  
  4.  
  5. ================================================================================
  6.  
  7. Binary Addition
  8. ---------------
  9. Binary Addition is a method used to convert a 8-bit register to a control-bank
  10. of 8-switches.  An 8-bit register can code itself into any decimal number
  11. between 0 and 255.  The following list illustrates how this works:
  12.  
  13. Register=8-Bits.
  14.  
  15.         Bit#      7    6    5    4    3    2    1    0
  16.  
  17.                  ---  --   --   --   --   --   --   --
  18.  
  19. Decimal value    128  64   32   16    8    4    2    1
  20.  
  21.  
  22. Each bit may equal zero, which is equivelent to that bit being "turned-OFF".
  23. If the value of the bit is asserted, then that specific bit is "turned-ON".
  24.  
  25. So how does one turn "ON" a combination of bits, while leaving others "OFF"?
  26.  
  27. This is accomplished by selecting the appropriate bits which must be "ON", then
  28. adding their specific values together as an agrigate, then sending this code to
  29. the register in the format required (hexidecimal or decimal; in most Hayes
  30. controlled modems, decimal is acceptable, SupraModems and SupraFAXModems are set
  31. in decimal).  For example; let's assume we wish to turn "ON" bits 0,2,4,5 and
  32. leave "OFF" everything else.  What is the resulting value?:
  33.  
  34.                       1+4+16+32=53 decimal
  35.  
  36. While the bits selected, get turned "ON", the effect of ignoring the other
  37. registers is to mask them "OFF", as a default.  Bits not selected, do not stay
  38. as they were, they will be reset (turned-OFF) by this action.
  39.  
  40. As you can see, this operation is simple, yet fundemental to the operation of
  41. modems and computers.  Yet this procedure is fairly "arcane" to many computer
  42. users. This text is an attempt to clarify this matter. We hope it helps you!
  43.  
  44. ================================================================================
  45.  
  46.  
  47.  
  48.